<template>
  <div id="self_bartending_addDevicel">
    <c-title :hide="false" text="添加设备"></c-title>
    <div class="addBox">
      <van-cell-group>
        <van-field v-model="code" label="设备编码" placeholder="请输入" />
      </van-cell-group>
    </div>
    <div class="bindBox">
      <div class="btn" @click="addDevice">绑定设备</div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      code: ""
      // time: "",
      // address: ""
    };
  },
  activated() {},
  methods: {
    async addDevice() {
      let { data, msg, result } = await $http.post(
        "plugin.self-bartending.api.employee.device.add",
        {
          device_sn: this.code
        },
        ""
      );
      if (result) {
        this.$toast(msg);
        this.$router.go(-1);
      } else {
        this.$toast(msg);
      }
    }
  }
};
</script>

<style lang="scss" scoped>
#self_bartending_addDevicel {
  margin: 0.63rem 0.75rem;
  .addBox {
    border-radius: 0.5rem;
    overflow: hidden;
  }
  .bindBox {
    background: #ffffff;
    padding: 0.63rem 0.75rem;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    .btn {
      flex: 1;
      background: #f15353;
      border-radius: 1.28rem;
      padding: 0.75rem 0;
      text-align: center;
      font-weight: 500;
      font-size: 0.94rem;
      color: #ffffff;
    }
  }
}
</style>
